var powers=new Array("7","9","10","5","8","4","2","1","6","3","7","9","10","5","8","4","2");
var parityBit=new Array("1","0","X","9","8","7","6","5","4","3","2");
function validId18(_id){
    console.log("校验身份证");
    _id=_id+"";
    var _num=_id.substr(0,17);
    var _parityBit=_id.substr(17);
    var _power=0;
    var sex = "";
    for(var i=0;i< 17;i++){
        //校验每一位的合法性
        if(_num.charAt(i)<'0'||_num.charAt(i)>'9'){
            return false;
            break;
        }else{
            //加权
            _power+=parseInt(_num.charAt(i))*parseInt(powers[i]);
            //设置性别
            if(i==16&&parseInt(_num.charAt(i))%2==0){
                sex="female";
            }else{
                sex="male";
            }
        }
    }
    //取模
    var mod=parseInt(_power)%11;
    console.log("MOD:"+mod);
    if(parityBit[mod]==_parityBit){
        return true;
    }
    return false;
}

String.prototype.replaceAll = function (FindText, RepText) {
    regExp = new RegExp(FindText, "g");
    return this.replace(regExp, RepText);
}

var paramArr = [
    '学生姓名',"身份证","学籍辅号","性别","当前长时间","当前短时间"
    ,"学校名称"
    ,"班级名称"
];
var paramArr2 =[
    "name","sfz","xjfh","sex","longDate","shortDate"
    ,"school_name"
    ,"bjxx_name"
];